<template>
    <span class="link-type" @click=operClick(nodeItem,scope)>{{ scope[prop]||scope.row[prop] }}</span>
</template>
<script setup>
import {ref} from 'vue'
import { parsingJson } from '@/utils/parsing'
import { useRouter } from 'vue-router'
const emit = defineEmits(['updateTable','confirmDelClick','openDialog'])
import {toTab} from './utils/hook.js'
const router = useRouter()
const props = defineProps({
    nodeItem: {
        type: Object,
        defalut: {}
    },
    scope:{
        type: Object,
        defalut: {}
    },
    prop:{
        type:String,
        defalut:''
    }
})
const dialogData = ref({
});
const operClick = (item, scope) => {
    let selectData = scope.row ||scope;
    dialogData.value = parsingJson(selectData, item);
    if(item.target == 'dialog'){
        emit('openDialog', item, dialogData.value)
    }
    else if (item.target == 'tab'){
        toTab(item,scope.row,router)
    }
}
</script>
<style lang="less" scoped>
.link-type,.link-type:focus {
    color: #337ab7;
    cursor: pointer;
}

.link-type:focus:hover,.link-type:hover {
    color: #20a0ff
}
</style>
